/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jse.concurrent;

import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;

/**
 *
 * @author WangShuai
 */
public class QueueTest {

    public static void main(String[] args) {
        //Queue is a interface,   Class LinkedList implements the Queue
        Queue queue = new LinkedList();

        queue = new PriorityQueue();  //Queue中的元素会按照自然顺序排序
        queue.offer("One");
        queue.offer("Two");
        queue.offer("Three");
        queue.offer("Four");
        // Head of queue should be One
        System.out.println("Head of queue is: " + queue.poll());  //poll remove队头元素

    }
}
